<!DOCTYPE html>
<html>

	<head>
		<meta charset="utf-8">
		<title>发布项目 - 网演中国粤西平台</title>
		<meta name="renderer" content="webkit">
		<meta http-equiv="X-UA-Compatible" content="IE=9,Chrome=1">
		<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
		<meta name="apple-mobile-web-app-capable" content="yes" />
		<meta name="apple-mobile-web-app-status-bar-style" content="black" />
		<link rel="stylesheet" type="text/css" href="../js/frameJS/layer/mobile/need/layer.css"/>
		<link rel="stylesheet" type="text/css" href="../css/frameCss/bootstrap.min.css"/>
		<link rel="stylesheet" type="text/css" href="../css/frameCss/animate.css" />
		<link rel="stylesheet" type="text/css" href="../css/public.css">
		<link rel="stylesheet" type="text/css" href="../css/publish.css">
	</head>

	<body>
		<header></header>
		<div class="remind">
			<p>发布粤剧信息</p>
		</div>

		<form action="" method="post" name="publishForm" id="publishForm" class="animated fadeInLeft">
			<input name="todo" type="hidden" value="todo">
			<div class="mod-form">
				<div class="form-group">
					<div class="form-item">
						<label>金额</label>
						<input type="text" pattern="[0-9]*" maxlength="8" id="amountmoney" name="amountmoney" placeholder="请填写金额" value="">
						<span>元</span>
					</div>
					<div class="form-cell">
						<ul>
							<li><input type="text" id="title" name="title" placeholder="请填写标题" value=""></li>
						</ul>
						<ul>
							<li><textarea id="content" name="content" placeholder="请详细描述情况" rows="6"></textarea></li>
						</ul>
					</div>
					<!--<div class="form-picture">
				<p>网页端（yx.wycn.com）发布支持<b>图文混排</b>格式</p>
			</div>-->

					<div class="form-img">
						<a class="file" href="javascript:;">
				            <span>点击选择要上传的图片</span>
				            <input type="file" name="file" id="uploadImg">
				        </a>
						<ul id="imgList">
							
						</ul>
					</div>
				</div>
				<div class="form-button"><input name="s" type="submit" id="s" value="提&nbsp;&nbsp;交"></div>
				<div class="form-readme">
					<p>我已阅读并同意
						<font color="#0099FF">《网演中国服务条款》</font>
					</p>
				</div>
			</div>
		</form>

		<footer id="bar-fixed">
			<a href="../index.html" class="tab-item"><i class="icon-tabbar bar-home"></i>首页</a>
			<a href="../category/category.html" class="tab-item"><i class="icon-tabbar bar-message"></i>分类</a>
			<a href="../publish/index.html" class="tab-item active"><i class="icon-tabbar bar-publish2"></i>发布</a>
			<a href="../user/index.html" class="tab-item"><i class="icon-tabbar bar-user"></i>我</a>
		</footer>

		<script src="../js/frameJS/jquery-2.1.1.min.js" type="text/javascript" charset="utf-8"></script>
		<script src="../js/frameJS/localResizeIMG-master/dist/lrz.bundle.js" type="text/javascript" charset="utf-8"></script>
		<script src="../js/frameJS/bootstrap.min.js" type="text/javascript" charset="utf-8"></script>
		<script src="../js/frameJS/layer/layer.js" type="text/javascript" charset="utf-8"></script>
		<script type="text/javascript">
			$(function() {

				//加载公共头部
				$('header').load('../commonTemplate/common-header.html');
				
				//上传图片
				$('#uploadImg').on('change', function() {
					// this.files[0] 是用户选择的文件
					lrz(this.files[0], {
							width: 1024,
							quality:0.7
					})
					.then(function(rst) {
						// 把处理的好的图片给用户看看呗
						var $imgList = document.getElementById('imgList')
						var img = new Image();
						img.src = rst.base64;
						//document.write(img.src);
						$.ajax({
         					url: "up.php",
         					type: "POST",
         					data:{trans_data:img.src},
         					//dataType: "json",
         					error: function(){  
          					   alert('Error loading XML document');  
        					},  
         					success: function(data,status){//如果调用php成功    
             				alert(unescape(data));//解码，显示汉字
         					}
    					});
	 
	 
						img.onload = function() {
							layer.msg('上传中...');
							$imgList.appendChild(img);
						};
						
						return rst;
					})

					.then(function(rst) {
						
						// 额外添加参数
						rst.formData.append('fileLen', rst.fileLen);
						 
//						$.ajax({
//						    url: 'http://koa-upload.coding.io', // 这个地址做了跨域处理，可以用于实际调试
//						    data: rst.formData,
//						    processData: false,
//						    contentType: false,
//						    type: 'POST',
//						    success: function (data) {
//						        config(JSON.stringify(data));
//						    }
//						});
//var my_data="rst.formData";
//     var my_data="";
     //my_data=escape(my_data)+"";//编码，防止汉字乱码
//     $.ajax({
//         url: "up.php",
//        type: "POST",
//         data:{trans_data:my_data},
//         //dataType: "json",
//         error: function(){  
//            alert('Error loading XML document');  
//        },  
//         success: function(data,status){//如果调用php成功    
//             alert(unescape(data));//解码，显示汉字
//         }
//     });


						return rst;
					})

					.catch(function(err) {
						// 万一出错了，这里可以捕捉到错误信息
						// 而且以上的then都不会执行

						alert(err);
					})

					.always(function() {
						// 不管是成功失败，这里都会执行
					});
				});
			})
		</script>
	</body>

</html>